package cn.wolfcode.p2p.base.query;

import cn.wolfcode.p2p.util.DateUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;

import java.util.Date;

/**
 * 登录日志查询对象
 */
@Setter
@Getter
public class IpLogQuery extends QueryObject {
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginDate; //开始时间

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate; //结束时间

    private Integer state = -1; //状态,默认全部

    private String username; //用户名

    private Integer userType = -1; //登录类型,默认全部

 /*   public Date getBeginDate() {
        return DateUtil.getBeginDate(beginDate);
    }*/

    public Date getEndDate() {
        return DateUtil.getEndDate(endDate);
    }

    public String getUsername() {
        return StringUtils.hasLength(username) ? username.trim() : null;
    }

}
